<DOCTYPE html>
<html>
<head>
	<meta charset="utf-8"> 
	<title>添加设备</title>
	<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css">  
	<script src="https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script>
	<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="{{ url_for('static', filename='style.css') }}" rel="stylesheet" type="text/css" />
<script src="{{ url_for('static', filename='yupload.js') }}"></script>
	
</head>
<body>

<form class="form-horizontal" role="form" id="form111">
<div class="form-group">
                <label for="firstname" class="col-sm-2 control-label">设备号</label>
                <div class="col-sm-10">
                        <input type="text" class="form-control" id="deviceid" name="deviceid"
                                   placeholder="234635234" value="{{deviceid}}">
                </div>
        </div>
	<div class="form-group">
		<label for="lastname" class="col-sm-2 control-label">设备名称</label>
		<div class="col-sm-10">
			<input type="text" class="form-control" id="devicename" name="devicename"
				   placeholder="JY-1在线扬尘测控系统" value="JY-1在线扬尘测控系统">
		</div>
	</div>
	<div class="form-group">
		<label for="firstname" class="col-sm-2 control-label">工程名称</label>
		<div class="col-sm-10">
			<input type="text" class="form-control" id="projectname" name="projectname"
				   placeholder="山西行政学院综合教学楼" value="山西行政学院综合教学楼">
		</div>
	</div>
	<div class="form-group">
		<label for="lastname" class="col-sm-2 control-label">生产厂家</label>
		<div class="col-sm-10">
			<input type="text" class="form-control" id="factoryname" name="factoryname"
				   placeholder="JY-1在线扬尘测控系统" value="JY-1在线扬尘测控系统">
		</div>
	</div>
	<div class="form-group">
		<label for="lastname" class="col-sm-2 control-label">编号</label>
		<div class="col-sm-10">
			<input type="text" class="form-control" id="devicenumber" name="devicenumber"
				   placeholder="tyadmin" value="tyadmin">
		</div>
	</div>
	<div class="form-group">
		<div class="col-sm-offset-2 col-sm-10">
			<input type="button" value="提交" id="upload-button">
			<!--<button type="submit" class="btn btn-default" onclick="btnAction()">提交</button>-->
		</div>
	</div>
</form>

</body>
<script>
	$(function () {

			// Handle the submit button.
		    $("#upload-button").on("click", function(e) {
				submit()
		    })
		});
function submit()
{

$.ajax({
                cache: false,
                type: "POST",
                url:"http://192.210.204.177:5000/add-device",
				data:$('#form111').serialize(),// 你的formid
				contentType: "application/x-www-form-urlencoded; charset=utf-8", 
                async: false,
                error: function(request) {
                    console.log("Connection error");
                },
                success: function(data) {
			console.log(data);
                }
            });
}
</script>
</html>

